.SUFFIXES: .c .o

COMPILE = $(CC) $(CFLAGS)
INC_PATH = -I../common -I../tracker -I../client -Ifdht_client -I/usr/local/include
LIB_PATH = -L/usr/local/lib $(LIBS)
TARGET_PATH = $(TARGET_PATH)

SHARED_OBJS = ../common/hash.o ../common/chain.o \
              ../common/shared_func.o ../common/ini_file_reader.o \
              ../common/logger.o ../common/sockopt.o ../common/fdfs_global.o \
              ../common/fdfs_base64.o ../common/sched_thread.o \
              ../tracker/tracker_proto.o tracker_client_thread.o \
              storage_global.o storage_func.o storage_service.o storage_sync.o \
              ../client/client_global.o ../client/tracker_client.o \
              ../client/storage_client.o \
              fdht_client/fdht_proto.o fdht_client/fdht_client.o \
              fdht_client/fdht_func.o

ALL_OBJS = $(SHARED_OBJS)

ALL_PRGS = fdfs_storaged 

all: $(ALL_OBJS) $(ALL_PRGS)
.o:
	$(COMPILE) -o $@ $<  $(SHARED_OBJS) $(LIB_PATH) $(INC_PATH)
.c:
	$(COMPILE) -o $@ $<  $(ALL_OBJS) $(LIB_PATH) $(INC_PATH)
.c.o:
	$(COMPILE) -c -o $@ $<  $(INC_PATH)
install:
	cp -f $(ALL_PRGS) $(TARGET_PATH)
clean:
	rm -f $(ALL_OBJS) $(ALL_PRGS)
